package com.mvc.rest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.model.test.face.UserService;


@Controller
public class RestController {
	
	private UserService userService;
    
    public RestController(){
        
    }
    
    @RequestMapping(value = "/login/{user}", method = RequestMethod.GET)   
    public ModelAndView myMethod(HttpServletRequest request, HttpServletResponse response,     
            @PathVariable("user") String user, ModelMap modelMap) throws Exception {  
        modelMap.put("loginUser", user);
        userService.saveSpring();
        return new ModelAndView("/login/hello", modelMap);
    }   
    
     @RequestMapping(value = "/_index", method = RequestMethod.GET)  
        public String registPost() {  
         return "/_index";
        }
     @RequestMapping(value = "/testui", method = RequestMethod.GET)  
     public String xx() {  
      return "testui";
     }
     @Autowired
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
      
}